package com.ruoyi.project.transport.other.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.transport.other.domain.Jlqtbd;
import com.ruoyi.project.transport.other.service.IJlqtbdService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 其它磅单Controller
 * 
 * @author frank
 * @date 2024-08-16
 */
@RestController
@RequestMapping("/transport/other/jlqtbd")
public class JlqtbdController extends BaseController
{
    @Autowired
    private IJlqtbdService jlqtbdService;

    /**
     * 查询其它磅单列表
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:list')")
    @GetMapping("/list")
    public TableDataInfo list(Jlqtbd jlqtbd)
    {
        startPage();
        List<Jlqtbd> list = jlqtbdService.selectJlqtbdList(jlqtbd);
        return getDataTable(list);
    }

    /**
     * 导出其它磅单列表
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:export')")
    @Log(title = "其它磅单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Jlqtbd jlqtbd)
    {
        List<Jlqtbd> list = jlqtbdService.selectJlqtbdList(jlqtbd);
        ExcelUtil<Jlqtbd> util = new ExcelUtil<Jlqtbd>(Jlqtbd.class);
        util.exportExcel(response, list, "其它磅单数据");
    }

    /**
     * 获取其它磅单详细信息
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:query')")
    @GetMapping(value = "/{jlQtbdoid}")
    public AjaxResult getInfo(@PathVariable("jlQtbdoid") String jlQtbdoid)
    {
        return success(jlqtbdService.selectJlqtbdByJlQtbdoid(jlQtbdoid));
    }

    /**
     * 新增其它磅单
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:add')")
    @Log(title = "其它磅单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Jlqtbd jlqtbd)
    {
        return toAjax(jlqtbdService.insertJlqtbd(jlqtbd));
    }

    /**
     * 修改其它磅单
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:edit')")
    @Log(title = "其它磅单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Jlqtbd jlqtbd)
    {
        return toAjax(jlqtbdService.updateJlqtbd(jlqtbd));
    }

    /**
     * 删除其它磅单
     */
    @PreAuthorize("@ss.hasPermi('transport/other:jlqtbd:remove')")
    @Log(title = "其它磅单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jlQtbdoids}")
    public AjaxResult remove(@PathVariable String[] jlQtbdoids)
    {
        return toAjax(jlqtbdService.deleteJlqtbdByJlQtbdoids(jlQtbdoids));
    }
}
